<div>
    <form method="post" enctype="multipart/form-data" class="form-horizontal bv-form"  role="form"  id="addForm">
    <fieldset>
        <legend>基本信息</legend>
        <div class="form-group">
            <label class="col-sm-3 control-label">轮播图名称</label>
            <div class="col-sm-8">
                <input type="text" class="form-control" name="lb_name" >
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">轮播图类型</label>
            <div class="col-sm-5">
                <select id="lb_type" name="lb_type" class="SearchForm form-control"  style="width:200px;height:32px;" >
                    <option value="1">课程</option>
                    <option value="2">项目</option>
                    <option value="3">公告</option>
                </select>
            </div>
        </div>
        <div class="form-group" id="show11">
            <label class="col-sm-3 control-label">选择课程</label>
            <div class="col-sm-5">
                <select name="lb_cid" class="SearchForm11 form-control"  style="width:200px;height:32px;" >
                    <option value="">选择课程</option>
                    {volist name="course" id='c'}
                    <option value="{$c['c_id']}">{$c['c_name']}</option>
                    {/volist}
                </select>
            </div>
        </div>
        <div class="form-group" id="show22" style="display: none">
            <label class="col-sm-3 control-label">选择项目</label>
            <div class="col-sm-5">
                <select name="lb_pid" class="SearchForm22 form-control"  style="width:200px;height:32px;" >
                    <option value="">选择项目</option>
                    {volist name="project" id='p'}
                    <option value="{$p['p_id']}">{$p['p_name']}</option>
                    {/volist}
                </select>
            </div>
        </div>
        <div class="form-group" id="show33" style="display: none">
            <label class="col-sm-3 control-label">选择公告</label>
            <div class="col-sm-5">
                <select name="lb_nid" class="SearchForm33 form-control"  style="width:200px;height:32px;" >
                    <option value="">选择公告</option>
                    {volist name="notice" id='n'}
                    <option value="{$n['n_id']}">{$n['n_title']}</option>
                    {/volist}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">轮播图</label>
            <div class="col-sm-8">
                <input onchange="aaaa(this);" type="file" name="pic" />
            </div>
            <br/>
            <br/>
            <div id="androimg" style="text-align: center"></div>
        </div>
    </fieldset>
</form>
</div>
<script>
    $('#lb_type').change(function () {
        var type = $('#lb_type').val();
        if(type == 1){
            $('#show11').css('display','block');$('#show22').css('display','none');$('#show33').css('display','none');
        }if(type == 2){
            $('#show22').css('display','block');$('#show11').css('display','none');$('#show33').css('display','none');
        }if(type == 3){
            $('#show33').css('display','block');$('#show22').css('display','none');$('#show11').css('display','none');
        }
    });
    function aaaa(file) {
        var prevDiv = document.getElementById('androimg');
        if (file.files && file.files[0])
        {
            var reader = new FileReader();
            reader.onload = function(evt){
                prevDiv.innerHTML = '<img src="' + evt.target.result + '" height="150"/>';
            };
            reader.readAsDataURL(file.files[0]);
        }
        else
        {
            prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
        }
    }

</script>